package com.repeat.member.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TopicConfig {
    public static final String TOPIC_EXCHANGE = "TopicEx";
    public static final String TOPIC_QUEUE1 = "TopicQu1";
    public static final String TOPIC_QUEUE2 = "TopicQu2";
    public static final String TOPIC_QUEUE3 = "TopicQu";
    public static final String TOPIC_ROUTING_KEY_WHITE = "directWhite";
    public static final String TOPIC_ROUTING_KEY_NEW = "new";
    public static final String TOPIC_ROUTING_KEY_WEATHER = "weather";



//    @Bean
//    public TopicExchange topicExchange() {
//        return ExchangeBuilder.topicExchange(TOPIC_EXCHANGE)
//                .durable(true)
//                .build();
//    }

    // 声明队列
//    @Bean
//    public Queue queue1() {
//        return QueueBuilder.durable(TOPIC_QUEUE1).build();
//    }
//
//    @Bean
//    public Queue queue2() {
//        return QueueBuilder.durable(TOPIC_QUEUE2).build();
//    }
//
//    // 绑定队列到交换机
//    @Bean
//    public Binding binding1(TopicExchange exchange, Queue queue1) {
//        // 匹配以 .orange. 结尾的路由键
//        return BindingBuilder.bind(queue1)
//                .to(exchange)
//                .with("*.orange.*");
//    }
//
//    @Bean
//    public Binding binding2(TopicExchange exchange, Queue queue2) {
//        // 匹配以 .rabbit 结尾的路由键
//        return BindingBuilder.bind(queue2)
//                .to(exchange)
//                .with("*.*.rabbit");
//    }

//    @Bean
//    public Binding binding3(TopicExchange exchange, Queue queue2) {
//        // 匹配以 lazy. 开头的路由键
//        return BindingBuilder.bind(queue2)
//                .to(exchange)
//                .with("lazy.#");
//    }
}
